<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>wickr-crypto-c: Wickr_root_keys</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">wickr-crypto-c
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Wickr_root_keys</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structwickr__root__keys.html">wickr_root_keys</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Root level crypto keys for signatures, local encryption, and remote encryption.  <a href="structwickr__root__keys.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gab6289774ce4bcbdc08584695f9b7c34c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#gab6289774ce4bcbdc08584695f9b7c34c">wickr_root_keys_create</a> (<a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *node_signature_root, <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *node_storage_root, <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *remote_storage_root)</td></tr>
<tr class="separator:gab6289774ce4bcbdc08584695f9b7c34c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac6d33868c25a85e5da5cff92a4eab189"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#gac6d33868c25a85e5da5cff92a4eab189">wickr_root_keys_generate</a> (const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *engine)</td></tr>
<tr class="separator:gac6d33868c25a85e5da5cff92a4eab189"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5ab25c65aa25fbe96d978f8e06376653"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#ga5ab25c65aa25fbe96d978f8e06376653">wickr_root_keys_create_from_buffer</a> (const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *engine, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *buffer)</td></tr>
<tr class="separator:ga5ab25c65aa25fbe96d978f8e06376653"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6875c9f677c4ec127276714976a623a5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#ga6875c9f677c4ec127276714976a623a5">wickr_root_keys_serialize</a> (const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *keys)</td></tr>
<tr class="separator:ga6875c9f677c4ec127276714976a623a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6e3a04e7e1c65ada93450051eb4f4459"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#ga6e3a04e7e1c65ada93450051eb4f4459">wickr_root_keys_export</a> (const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *keys, const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *engine, const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *export_key)</td></tr>
<tr class="separator:ga6e3a04e7e1c65ada93450051eb4f4459"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa34dd6c85c667b8b7fb025f56c7bcc46"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__storage__keys.html">wickr_storage_keys_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#gaa34dd6c85c667b8b7fb025f56c7bcc46">wickr_root_keys_localize</a> (const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *keys, const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *engine, const <a class="el" href="structwickr__dev__info.html">wickr_dev_info_t</a> *dev_info)</td></tr>
<tr class="separator:gaa34dd6c85c667b8b7fb025f56c7bcc46"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadda1b8fd1b5cc1cf6b7b2b0e72912858"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#gadda1b8fd1b5cc1cf6b7b2b0e72912858">wickr_root_keys_copy</a> (const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *source)</td></tr>
<tr class="separator:gadda1b8fd1b5cc1cf6b7b2b0e72912858"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacabc33b7c56cbc84a5085d0a4330694f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__root__keys.html#gacabc33b7c56cbc84a5085d0a4330694f">wickr_root_keys_destroy</a> (<a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> **keys)</td></tr>
<tr class="separator:gacabc33b7c56cbc84a5085d0a4330694f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="gadda1b8fd1b5cc1cf6b7b2b0e72912858"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadda1b8fd1b5cc1cf6b7b2b0e72912858">&#9670;&nbsp;</a></span>wickr_root_keys_copy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a>* wickr_root_keys_copy </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td>
          <td class="paramname"><em>source</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Copy a root key set</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>the root key set to copy </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated root key set holding a deep copy of the properties of 'source' </dd></dl>

</div>
</div>
<a id="gab6289774ce4bcbdc08584695f9b7c34c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab6289774ce4bcbdc08584695f9b7c34c">&#9670;&nbsp;</a></span>wickr_root_keys_create()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a>* wickr_root_keys_create </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td>
          <td class="paramname"><em>node_signature_root</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>node_storage_root</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>remote_storage_root</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a root key set from components</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node_signature_root</td><td>see '<a class="el" href="structwickr__root__keys.html" title="Root level crypto keys for signatures, local encryption, and remote encryption.">wickr_root_keys</a>' property documentation </td></tr>
    <tr><td class="paramname">node_storage_root</td><td>see '<a class="el" href="structwickr__root__keys.html" title="Root level crypto keys for signatures, local encryption, and remote encryption.">wickr_root_keys</a>' property documentation </td></tr>
    <tr><td class="paramname">remote_storage_root</td><td>see '<a class="el" href="structwickr__root__keys.html" title="Root level crypto keys for signatures, local encryption, and remote encryption.">wickr_root_keys</a>' property documentation </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated root key set. Takes ownership of the passed inputs </dd></dl>

</div>
</div>
<a id="ga5ab25c65aa25fbe96d978f8e06376653"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5ab25c65aa25fbe96d978f8e06376653">&#9670;&nbsp;</a></span>wickr_root_keys_create_from_buffer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a>* wickr_root_keys_create_from_buffer </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *&#160;</td>
          <td class="paramname"><em>engine</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a root key set from the serialized output of 'wickr_root_keys_serialize'</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">engine</td><td>a crypto engine to validate the decoded EC keys </td></tr>
    <tr><td class="paramname">buffer</td><td>a buffer containing serialized root keys </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a root key set parsed out of buffer, or NULL if parsing fails </dd></dl>

</div>
</div>
<a id="gacabc33b7c56cbc84a5085d0a4330694f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacabc33b7c56cbc84a5085d0a4330694f">&#9670;&nbsp;</a></span>wickr_root_keys_destroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wickr_root_keys_destroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> **&#160;</td>
          <td class="paramname"><em>keys</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Destroy a root key set</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">keys</td><td>a pointer to a root key set to destroy. Will destroy the sub properties of '*keys' as well </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga6e3a04e7e1c65ada93450051eb4f4459"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6e3a04e7e1c65ada93450051eb4f4459">&#9670;&nbsp;</a></span>wickr_root_keys_export()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a>* wickr_root_keys_export </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td>
          <td class="paramname"><em>keys</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *&#160;</td>
          <td class="paramname"><em>engine</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>export_key</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Serialize and encrypt root keys</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">keys</td><td>the keys to serialize and encrypt </td></tr>
    <tr><td class="paramname">engine</td><td>a crypto engine capable of encrypting data using 'export_key' </td></tr>
    <tr><td class="paramname">export_key</td><td>the key to use for encryption of the serialized keys </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a cipher result of serialized 'keys' encrypted with 'export_key' </dd></dl>

</div>
</div>
<a id="gac6d33868c25a85e5da5cff92a4eab189"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac6d33868c25a85e5da5cff92a4eab189">&#9670;&nbsp;</a></span>wickr_root_keys_generate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a>* wickr_root_keys_generate </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *&#160;</td>
          <td class="paramname"><em>engine</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate a random set of root keys</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">engine</td><td>a crypto engine supporting random EC and cipher key generation </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a random set of root keys </dd></dl>

</div>
</div>
<a id="gaa34dd6c85c667b8b7fb025f56c7bcc46"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa34dd6c85c667b8b7fb025f56c7bcc46">&#9670;&nbsp;</a></span>wickr_root_keys_localize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__storage__keys.html">wickr_storage_keys_t</a>* wickr_root_keys_localize </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td>
          <td class="paramname"><em>keys</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> *&#160;</td>
          <td class="paramname"><em>engine</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__dev__info.html">wickr_dev_info_t</a> *&#160;</td>
          <td class="paramname"><em>dev_info</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convert a root key set into a storage key set for a local device</p>
<p>Currently the local storage key is created by taking SHA256(keys-&gt;node_storage_root || dev_info-&gt;system_salt)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">keys</td><td>the keys to convert </td></tr>
    <tr><td class="paramname">engine</td><td>a crypto engine to use for conversion </td></tr>
    <tr><td class="paramname">dev_info</td><td>the device to localize the keys to </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a set of storage keys bound to 'dev_info' </dd></dl>

</div>
</div>
<a id="ga6875c9f677c4ec127276714976a623a5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6875c9f677c4ec127276714976a623a5">&#9670;&nbsp;</a></span>wickr_root_keys_serialize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* wickr_root_keys_serialize </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__root__keys.html">wickr_root_keys_t</a> *&#160;</td>
          <td class="paramname"><em>keys</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Serialize root keys into a buffer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">keys</td><td>the keys to serialize </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing serialized root keys as a protocol buffer object </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
